//package lucene;
//
//import java.io.File;
//import java.io.IOException;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//import javax.xml.parsers.DocumentBuilder;
//
//import lion.dev.lang.KV;
//import lucene.search.QueryBuilder;
//import lucene.search.SearchResult;
//
//import org.apache.lucene.analysis.Analyzer;
//import org.apache.lucene.analysis.standard.StandardAnalyzer;
//import org.apache.lucene.document.Document;
//import org.apache.lucene.document.Field;
//import org.apache.lucene.document.FieldType;
//import org.apache.lucene.document.LongField;
//import org.apache.lucene.document.StringField;
//import org.apache.lucene.document.TextField;
//import org.apache.lucene.index.DirectoryReader;
//import org.apache.lucene.index.IndexReader;
//import org.apache.lucene.index.IndexWriter;
//import org.apache.lucene.index.IndexWriterConfig;
//import org.apache.lucene.index.IndexWriterConfig.OpenMode;
//import org.apache.lucene.index.Term;
//import org.apache.lucene.queryparser.classic.ParseException;
//import org.apache.lucene.queryparser.classic.QueryParser;
//import org.apache.lucene.search.IndexSearcher;
//import org.apache.lucene.search.Query;
//import org.apache.lucene.search.ScoreDoc;
//import org.apache.lucene.store.Directory;
//import org.apache.lucene.store.FSDirectory;
//import org.apache.lucene.util.Version;
//
///**
// * @author lion
// * @email hl_0074@sina.com
// * @date 2014年4月14日
// */
//public class T {
//
//	public static void main(String[] args) throws IOException {
//
//		Analyzer analyzer = null;
//		SEManager seManagerx = new SEManager();
//		SEManager seManager = new SEManager(analyzer);
//		SEManager seManager1 = new SEManager("", analyzer);
//
//		DocumentBuilder builder = null;
//		List<DocumentBuilder> builders = null;
//		// index
//		seManager.setBatch(true);
//		seManager.index(builder);
//		seManager.index(builders);
//		seManager.setBatch(false);
//
//		String fld = null;
//		String value = null;
//		seManager.delete(fld, value);
//
//		String[][] kvs = new String[2][];
//		seManager.delete(kvs);
//		Map<String, String> param = new HashMap<>();
//		seManager.delete(param);
//
//		seManager.udpate(fld, builder);
//		seManager.udpate(new KV<String, DocumentBuilder>("", builder));
//
//		// index files ops
//		seManager.optimize();
//		seManager.merge(seManager1);
//		seManager.destory();
//
//		// search
//		QueryBuilder qb = null;
//		int total = seManager.count(qb);
//		SearchResult result = seManager.search(qb);
//
//		// t();
//	}
//
//	private static void t() throws IOException, ParseException {
//
//		Directory dir = FSDirectory.open(new File("D:/index"));
//		Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_47);
//
//		// index
//		IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_47, analyzer);
//		iwc.setOpenMode(OpenMode.CREATE_OR_APPEND);
//		iwc.setRAMBufferSizeMB(256);
//
//		IndexWriter writer = new IndexWriter(dir, iwc);
//		// writer.addIndexes(null);
//		writer.addDocuments(null, analyzer);
//
//		Document document = new Document();
//		document.add(new StringField(null, null, null));
//		document.add(new LongField(null, 0, null));
//		document.add(new TextField(null, null));
//
//		document.add(new Field("", "", FieldType.NumericType.FLOAT));
//
//		writer.addDocument(document);
//		//
//		writer.updateDocument(new Term("", ""), document);
//		writer.forceMerge(1);
//		writer.close();
//
//		// search
//		IndexReader reader = DirectoryReader.open(FSDirectory.open(new File("")));
//		IndexSearcher searcher = new IndexSearcher(reader);
//		Analyzer analyzer2 = new StandardAnalyzer(Version.LUCENE_47);
//		QueryParser qp = new QueryParser(Version.LUCENE_47, field, analyzer);
//		Query query = qp.parse("");
//
//		ScoreDoc[] hits = searcher.search(query, 100).scoreDocs;
//		for (ScoreDoc scoreDoc : hits) {
//			Document doc = searcher.doc(scoreDoc.doc);
//		}
//		reader.close();
//	}
// }
